﻿using System.Collections.Generic;
using System.Net.Http;
using System.Web.Http;
using Freedom.Repository.Models;
using Freedom.Services.Interface;

namespace Freedom.JqxGrid.WebApi
{
    public class ProductsController : ApiController
    {
        private readonly IProductService _productService;

        public ProductsController(IProductService productService)
        {
            _productService = productService;
        }

        public IEnumerable<Product> GetAllProducts()
        {
            return _productService.GetAllProducts();
        }

        public object GetPageProducts(int pagenum, int pagesize, string sortDataField=null, string sortOrder="")
        {
            return _productService.GetPageProducts(pagenum, pagesize, sortDataField, sortOrder);
        }
    }
}
